package com.ydl.learning.flink.demo.mySource

import java.util.UUID

import org.apache.flink.streaming.api.functions.source.{RichParallelSourceFunction, SourceFunction}

/**
 *
 *
 * @author ydl
 * @since 2020/12/9
 */
class StringSource extends RichParallelSourceFunction[String] {
  override def run(ctx: SourceFunction.SourceContext[String]): Unit = {
    while (true){
      val str = UUID.randomUUID()
      ctx.collect(str.toString)
      Thread.sleep(60000)
    }
  }

  override def cancel(): Unit = {
  }
}
